#include "engine.h"
#include "rendermaterial.h"
#include "shader.h"
#include <gl/glew.h>


void renderstateblock_t::set()
{
	if (cull)
	{
		glEnable(GL_CULL_FACE);
	}
	else
	{
		glDisable(GL_CULL_FACE);
	}

	if (alphatest)
	{
		glEnable(GL_ALPHA_TEST);
		glAlphaFunc(GL_GREATER,0.5f);
	}
	else
	{
		glDisable(GL_ALPHA_TEST);
	}

	glDepthMask(depthmask);
	glBlendFunc(blendfunc.sfactor,blendfunc.dfactor);
}

void rendermaterial_t::set()
{
	shader->set();
	rsb.set();
}